package com.jack.leetcode.math;

/*** 
 * @author zhangjie
 * @date 2020/5/8 22:42
 */
public class 回文数 {

    public static void main(String[] args) {
        int x = 10;
        System.out.println(isPalindrome(x));
    }

    public static boolean isPalindrome(int x) {
        if(x == 0){
            return true;
        }
        if(x < 0){
            return false;
        }
        StringBuilder s = new StringBuilder(x+"").reverse();
        StringBuilder l = new StringBuilder(x+"");

        for(int i=0;i<s.length();i++){
            if(s.charAt(i) != l.charAt(i)){
                return false;
            }
        }
        return true;
    }
}
